#ifndef CPP_TOOLS_SK_STORAGE_LOG_HPP
#define CPP_TOOLS_SK_STORAGE_LOG_HPP

#include "nec_fs/file_writer.hpp"
#include "sk_storage/const.hpp"
#include "sk_storage/util.hpp"
#include <nec_fs/file_reader.hpp>

#include <string>

namespace sk_storage {
namespace log {

class DiskItem {
private:
  std::string key_, value_;
  uint64_t log_id_{};

public:

  DiskItem() = default;

  DiskItem(std::string &&key, std::string &&value);

  DiskItem(const std::string &key, const std::string &value);

  uint64_t log_id() const { return log_id_; }

  std::string key() const { return key_; }

  std::string value() const { return value_; }

  Status SerializeTo(std::string &serialize_str);

  Status UnSerializeTo(const std::string &un_serialize_str);

  ~DiskItem() = default;
};

class Writer {
private:
  nec_fs::FileWriter *file_writer_;

public:
  Writer(const std::string &filename);

  int Write(const std::string &log_info);

  ~Writer();
};

class Reader {
private:

  nec_fs::FileReader *file_reader_;

public:
  Reader(const std::string &filename);

  int Read(std::string &log_info);

  ~Reader();
};

} // namespace log
} // namespace sk_storage

#endif